package com.oddfar.campus.business.service.Impl;

import com.oddfar.campus.business.domain.Clqkxx;
import com.oddfar.campus.common.domain.PageResult;
import com.oddfar.campus.common.utils.SecurityUtils;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.oddfar.campus.business.mapper.TcwxxMapper;
import com.oddfar.campus.business.domain.Tcwxx;
import com.oddfar.campus.business.service.TcwxxService;
@Service
public class TcwxxServiceImpl extends ServiceImpl<TcwxxMapper, Tcwxx> implements TcwxxService{

    @Autowired
    private TcwxxMapper tcwxxMapper;

    @Override
    public PageResult<Tcwxx> page(Tcwxx tcwxx) {
        Long userId = SecurityUtils.getUserId();
        if (userId != 1) {
            return tcwxxMapper.selectPage(tcwxx, userId);
        }
        return tcwxxMapper.selectPage(tcwxx);
    }

    @Override
    public int insertTcwxx(Tcwxx tcwxx) {
        tcwxx.setDelFlag(false);
        return tcwxxMapper.insert(tcwxx);
    }

    @Override
    public int updateTcwxx(Tcwxx tcwxx) {
        return tcwxxMapper.updateById(tcwxx);
    }
}
